layui.define(['index', 'form', 'admin', 'layer'], function () {
    window.$ = layui.$;
    let form = layui.form;
    let layer = layui.layer;
    let admin = layui.admin;
    let layedit = layui.layedit;

    //动态回填
    form.val('zmn-part-category-form', json.items);

    form.verify({
        sort: function (value, item) {
            if (!zmnRegularExpressionUtil.isNonNegativeInteger(value)) {
                console.log(value)
                if (value !== "") {
                    return "排序号为大于0的整数";
                }
            }
        }
    });

    //监听表单提交
    form.on('submit(zmn-part-category-form-submit)', function (data) {
        zmnLayUtil.ajaxResultDTOJson(parent.layui.layer, "/part/category/second/ajax/addEdit.action", data.field, 0, function () {
            zmnLayUtil.closeThisIframe(parent, {tableSelector: "zmn-part-category-second-table"})
        });
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });

    //监听关闭按钮
    $("#cancel").on("click", function () {
        zmnLayUtil.closeThisIframe(parent);
    })


});
